package com.bjpowernode.service.impl;

import com.bjpowernode.dao.CollectDao;
import com.bjpowernode.service.CollectService;
import com.bjpowernode.user.Collect;
import com.bjpowernode.user.Dynamic;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CollectServiceImpl implements CollectService {

    @Resource
    private CollectDao collectDao;

    @Override
    public int addCollect(Collect collect) {
        Collect findCollect = collectDao.noDoubleCollect(collect);
        if (findCollect != null){
            return 0;
        }
        return collectDao.insertCollect(collect);
    }

    @Override
    public int deleteCollect(Collect collect) {
        return collectDao.deleteCollect(collect);
    }

    @Override
    public List<Dynamic> findSelfCollect(String name) {
        return collectDao.selectSelfCollect(name);
    }
}
